
<!--
 * @Description: 
 * @Author: zwx
 * @Date: 2024-11-14 16:18:51
 * @LastEditors: zwx
 * @LastEditTime: 2024-11-15 16:10:38
 * @又活了一天: 你真厉害！！！
-->
//第二次作业
<!-- <script setup>
import Login from './components/views/Login.vue'
import Register from './components/views/Register.vue'
import { ref } from 'vue'
const flag = ref(false);
// 添加切换方法
function changeFlag(){
    flag.value = !flag.value;
}
</script>

<template>
<Login v-if="flag"></Login>
<Register v-else></Register> 
<button class="btu" @click="changeFlag">{{ flag?'没有账号？立即注册':'已有账号？立即登录' }}</button> 
</template>

<style scoped>
.btu{
  font-size: 15px;
  color: #a6a6a6;
  text-align: right;
  background-color: white;
  position: absolute;
  top: 85px;
  right: 410px;
  border: 0px ;
}
</style> -->

<script setup>
import { ref } from 'vue';
import Login from './components/views/Login.vue'
import Register from './components/views/Register.vue'

const isLogin = ref(false);

function toggleForm() {
  isLogin.value = !isLogin.value;
}
</script>

<template>
  
  <div class="background">
    
    <div class="form-container">
      <Login v-if="isLogin" @toggle="toggleForm" />
      <Register v-else @toggle="toggleForm" />
      <button @click="toggleForm">
        {{ isLogin ? '切换到注册' : '切换到登录' }}
      </button>
    </div>
  </div>
</template>

<style scoped>
.background {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 80vw;
  height: 70vh;
  background-image: url('./assets/login_bg.png');
}

.form-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 50%;
  height: 50%;
  background: rgba(255, 255, 255, 0.8); 
  padding: 2rem; 
  border-radius: 8px; 
}

/* button {
  margin-top: 1rem;
  padding: 0.5rem 1rem;
  border: none;
  background-color: #007BFF;
  color: white;
  border-radius: 4px;
  cursor: pointer;
}

button:hover {
  background-color: #0056b3;
} */
</style>